IF(CHECK_MEMORY)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CHECK_MEMORY_FLAGS}")
ENDIF(CHECK_MEMORY)

#IF(WIN32)
#  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDLL_TULIP")
#ENDIF(WIN32)

INCLUDE_DIRECTORIES(
  ${ZLibInclude}
  ${GZStreamInclude}
  ${QHULLInclude}
  ${UTF8CppInclude}
  ${YAJLInclude}
  ${OGDFInclude}
  ${TulipCoreInclude}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
)

LINK_DIRECTORIES(
    ${CMAKE_BINARY_DIR}/bin
)

SET(tulip_LIB_INCS
  tulip/Plugin.h
  tulip/AbstractProperty.h
  tulip/AcyclicTest.h
  tulip/Algorithm.h
  tulip/Array.h
  tulip/Bfs.h
  tulip/BiconnectedTest.h
  tulip/BooleanProperty.h
  tulip/BoundingBox.h
  tulip/Circle.h
  tulip/Color.h
  tulip/ColorProperty.h
  tulip/ColorScale.h
  tulip/ConcatIterator.h
  tulip/ConnectedTest.h
  tulip/ConsoleUtils.h
  tulip/conversioniterator.h
  tulip/ConvexHull.h
  tulip/Coord.h
  tulip/DataSet.h
  tulip/Delaunay.h
  tulip/DoubleProperty.h
  tulip/DrawingTools.h
  tulip/Edge.h
  tulip/ExportModule.h
  tulip/Face.h
  tulip/FaceIterator.h
  tulip/filteriterator.h
  tulip/ForEach.h
  tulip/GraphAbstract.h
  tulip/GraphDecorator.h
  tulip/Graph.h
  tulip/GraphTest.h
  tulip/GraphMeasure.h
  tulip/GraphProperty.h
  tulip/GraphTools.h
  tulip/ImportModule.h
  tulip/IntegerProperty.h
  tulip/Iterator.h
  tulip/LayoutProperty.h
  tulip/MapIterator.h
  tulip/Matrix.h
  tulip/memorypool.h
  tulip/minmaxproperty.h
  tulip/MutableContainer.h
  tulip/Node.h
  tulip/NumericProperty.h
  tulip/Observable.h
  tulip/Ordering.h
  tulip/OuterPlanarTest.h
  tulip/PlanarConMap.h
  tulip/PlanarityTest.h
  tulip/PluginContext.h
  tulip/PluginLibraryLoader.h
  tulip/PluginLister.h
  tulip/PluginLoader.h
  tulip/PluginLoaderTxt.h
  tulip/PluginProgress.h
  tulip/TemplateAlgorithm.h
  tulip/PropertyAlgorithm.h
  tulip/PropertyInterface.h
  tulip/PropertyTypes.h
  tulip/PropertyWrapper.h
  tulip/QuadTree.h
  tulip/Rectangle.h
  tulip/SimplePluginProgress.h
  tulip/SimpleTest.h
  tulip/Size.h
  tulip/SizeProperty.h
  tulip/SortIterator.h
  tulip/StableIterator.h
  tulip/StlFunctions.h
  tulip/StlIterator.h
  tulip/StoredType.h
  tulip/StringCollection.h
  tulip/StringProperty.h
  tulip/SystemDefinition.h
  tulip/TlpTools.h
  tulip/TreeTest.h
  tulip/TriconnectedTest.h
  tulip/tulipconf.h
  tulip/TulipException.h
  tulip/tuliphash.h
  tulip/TulipPluginHeaders.h
  tulip/TulipViewSettings.h
  tulip/uniqueiterator.h
  tulip/VectorCast.h
  tulip/vectorgraph.h
  tulip/vectorgraphproperty.h
  tulip/Vector.h
  tulip/WithDependency.h
  tulip/WithParameter.h
  tulip/TypeInterface.h
  tulip/SerializableType.h
  tulip/TulipRelease.h
  tulip/YajlFacade.h
)

SET(tulip_LIB_SRCS ${tulip_LIB_SRCS}
  Plugin.cpp
  AcyclicTest.cpp
  Bfs.cpp
  BiconnectedTest.cpp
  BooleanProperty.cpp
  BoundingBox.cpp
  Color.cpp
  ColorProperty.cpp
  ColorScale.cpp
  ConnectedTest.cpp
  ConvexHull.cpp
  DataSet.cpp
  Delaunay.cpp
  DoubleProperty.cpp
  DrawingTools.cpp
  FaceIterator.cpp
  GraphAbstract.cpp
  Graph.cpp
  GraphDecorator.cpp
  GraphImpl.cpp
  GraphIterator.cpp
  GraphMeasure.cpp
  GraphProperty.cpp
  GraphStorage.cpp
  GraphTools.cpp
  GraphUpdatesRecorder.cpp
  GraphView.cpp
  IdManager.cpp
  IntegerProperty.cpp
  LayoutProperty.cpp
  MapIterator.cpp
  Observable.cpp
  Ordering.cpp
  OuterPlanarTest.cpp
  PlanarConMap.cpp
  PlanarityTest.cpp
  PlanarityTestEmbed.cpp
  PlanarityTestImpl.cpp
  PlanarityTestObstr.cpp
  PlanarityTestTools.cpp
  Plane.cpp
  PluginLibraryLoader.cpp
  PluginLoaderTxt.cpp
  PropertyAlgorithm.cpp
  PropertyInterface.cpp
  PropertyManager.cpp
  PropertyTypes.cpp
  SimplePluginProgress.cpp
  SimpleTest.cpp
  SizeProperty.cpp
  StlFunctions.cpp
  StringCollection.cpp
  StringProperty.cpp
  TlpTools.cpp
  TreeTest.cpp
  TriconnectedTest.cpp
  vectorgraph.cpp
  WithParameter.cpp
  PluginLister.cpp
  tulipconf.cpp
  TulipException.cpp
  PluginProgress.cpp
  TulipViewSettings.cpp
  YajlFacade.cpp
  #TlpJsonImport.cpp
  #TlpJsonExport.cpp
  #TLPBImport.cpp
  #TLPBExport.cpp
  #TLPImport.cpp
  #TLPExport.cpp
)

IF(CHECK_MEMORY)
  SET(tulip_LIB_SRCS ${tulip_LIB_SRCS} MemoryChecker.cpp)
ENDIF(CHECK_MEMORY)

IF(EMSCRIPTEN)
SET(tulip_LIB_SRCS ${tulip_LIB_SRCS}
                    ../../../plugins/layout/DatasetTools.cpp
                    ../../../plugins/layout/OrientableCoord.cpp
                    ../../../plugins/layout/OrientableLayout.cpp
                    ../../../plugins/layout/OrientableSize.cpp
                    ../../../plugins/layout/OrientableSizeProxy.cpp
                    ../../../plugins/layout/Orientation.cpp)
ENDIF(EMSCRIPTEN)

#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_TULIP_LIB_DIR=\"\\\"${CMAKE_INSTALL_PREFIX}/lib/\\\"\"")

IF(BUILD_TULIP_SHARED)
    SET(TULIP_LIB_TYPE SHARED)
    SET(TULIP_LIB_DEFINITIONS "-DTULIP_DLL -DTULIP_EXPORT -DGZSTREAM_DLL -DYAJL_DLL -DZLIB_DLL")
ELSE()
    SET(TULIP_LIB_TYPE STATIC)
ENDIF()

IF(MSVC)
    ADD_DEFINITIONS(${TULIP_LIB_DEFINITIONS})
ENDIF()


ADD_LIBRARY(${LibTulipCoreName} ${TULIP_LIB_TYPE} ${tulip_LIB_SRCS} ${tulip_LIB_INCS})

TARGET_LINK_LIBRARIES(${LibTulipCoreName} ${GZStreamLibrary} ${YajlLibrary} ${QHULLLibrary} ${ZLibLibrary})

SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
